<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\ArticleCat
 *
 * @property int $cat_id
 * @property string $cat_name
 * @property int $cat_type
 * @property string $keywords
 * @property string $cat_desc
 * @property int $sort_order
 * @property int $show_in_nav
 * @property int $parent_id
 * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Article> $articles
 * @property-read int|null $articles_count
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat query()
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereCatDesc($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereCatId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereCatName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereCatType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereKeywords($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereParentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereShowInNav($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ArticleCat whereSortOrder($value)
 * @mixin \Eloquent
 */
class ArticleCat extends Model
{
    protected $table = 'article_cat';
    protected $primaryKey = 'cat_id';
    protected $fillable = ['cat_id', 'cat_name', 'cat_type', 'keywords', 'cat_desc', 'sort_order', 'show_in_nav', 'parent_id'];

    public $timestamps = false;

    public function articles()
    {
        return $this->hasMany(Article::class, 'cat_id', 'cat_id');
    }
}
